/*
 * This class will be used to work with National League Salaries in 2005
 * @author Jeff Borland(change)
 * @date 3-26-06
 */
import java.io.*;
import java.util.Scanner;
public class ArrayActivities
{
   int[] allSalaries = new int [200000];
   Scanner scan;  
   private long start;
   private long finish;   
   
    /*
     * The constructor below will automatically read in all of the Baseball player salaries
     */
    public ArrayActivities() 
    {
        startClock();
        reset(); //resets the scanner to the beginning of the file
        int i=0;
        while (scan.hasNext() && i<200000)
        {
            String theLine=scan.nextLine(); //This reads in the next player line                           
            int salary=Integer.parseInt(theLine);  //converts the string salary to an integer
            allSalaries[i]=salary;
            i++;                       
        }
        stopClock();
    }
    
    public void startClock()
    {     
        start = System.currentTimeMillis();   
    }
    public void stopClock()
    {
        finish= System.currentTimeMillis();   
        System.out.println( "This operation took " + (finish-start) + " milliseconds.");
    }

    
    
    
    //Conrad cleverly put this code in a method so that we can reset quickly.
    //He also appropriately made it private
    private void reset()
    {
        //To reset your scanner:
        try
        {
            scan=new Scanner(new File("salaries.txt"));
        }
        catch (IOException e){}
    }    
    
}